'use strict';
const nunjucks = require('nunjucks');

function crenteEnv(path,opts){
    path = path || 'views';
    opts = opts || {};
    let confOpts = {

    };
    let env = nunjucks.configure(path);
    return env;
};


module.exports = async(ctx,next)=>{
    ctx.render = function (view,model,path,opts){
        let env =  crenteEnv(path,opts);
        ctx.body = env.render(view,model)
    }
};